package com.czb.seckill.util;

import org.springframework.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author: 陈正彬
 * 完成校验工具类，如手机号格式是否正确
 */
public class ValidatorUtil {

    //校验手机号码，正则表达式
    private static final Pattern mobile_pattern = Pattern.compile("^[1][3-9][0-9]{9}$");

    //
    public static boolean isMobile(String mobile) {
        if (!StringUtils.hasText(mobile)){
            return false;
        }
        Matcher matcher = mobile_pattern.matcher(mobile);
        return matcher.matches();
    }
}
